import React from "react";
import {ActivityIndicator} from 'react-native';

// 提示框
import {Toast, Theme} from 'teaset'

let customKey = null;

// 自定义提示框toast显示
Toast.showLoading = (text) => {
  if (customKey) return;
  customKey = Toast.show({
    text,
    icon: <ActivityIndicator size='large' color={Theme.toastIconTintColor}/>,
    position: "center",
    duration: 10000,
  });
};

// toast隐藏
Toast.hideLoading = () => {
  if (!customKey) return;
  Toast.hide(customKey);
  customKey = null;
};

export default Toast;